//
//  GlobalFile.swift
//  ThousandsEuropean
//
//  Created by apple on 2019/12/31.
//  Copyright © 2019 肖恩. All rights reserved.
//

import UIKit
import Kingfisher
import SwiftyJSON
import SnapKit
import ESPullToRefresh
/// 屏幕bounds
let SCREEN_BOUNDS = UIScreen.main.bounds


/// 设计颜色- （黑色）
let Black_COLOR = UIColor.init(r: 38, g: 42, b: 56)
/// 设计颜色- （灰色）
let Gray_COLOR = UIColor.init(r: 144, g: 145, b: 152)
/// 设计颜色- （红色）
let Red_COLOR = UIColor.init(r: 244, g: 51, b: 49)
/// 设计颜色- （蓝色）
let Blue_COLOR = UIColor.init(r: 62, g: 134, b: 250)
/// 设计颜色- （橘色）
let Orange_COLOR = UIColor.init(r: 255, g: 138, b: 0)
/// 设计颜色- （绿色）
let Green_COLOR = UIColor.init(r: 12, g: 182, b: 113)
/// 设计颜色- （黄色）
let Yellow_COLOR = UIColor.init(r: 255, g: 142, b: 74)

/// 微信支付
let wxAppid = "wx971fb53dc86078b4"
//let wxAppSecret = "cb402f3fd250bf733d8e549b65639222"

let APIKey = "678f1ebeefa8d205f1bc2f9ced0a8598"

let alAppKey = "333420675"
let alAppSecret = "90f98ca134cc4a78a22a1ddfaf855e3e"

let PNSATAUTHSDKINFOKEY = "ATAuthSDKInfoKey"
let PNSATAUTHSDKINFO  = "2NAvQnLIZOC9kDTDveOkyezPysRC+ZneLg6xuBNpT73w9PuDlhOqG4kHqhBQaTUmhmimkb8uU1HfHbmld4FX688WKNCgiUYJA2PeIt7aQBpCNg8kfEGmMg+Jtk/YIKZ5VeEi7wDbwjYNg+fnvsDYkyJW2WM5koqYMf9obdvn6W6WHOqWol0r7tmryQfkwTlNi9+vYxn2gbpXN1NZxSEZxVkb0K7wzYtYUcMlrqGiYZINapROXjR1M6APHQLvJMI5NNmNDfVSaiA="

var topVC: UIViewController? {
    var resultVC: UIViewController?
    resultVC = _topVC(UIApplication.shared.keyWindow?.rootViewController)
    while resultVC?.presentedViewController != nil {
        resultVC = _topVC(resultVC?.presentedViewController)
    }
    return resultVC
}

private  func _topVC(_ vc: UIViewController?) -> UIViewController? {
    if vc is UINavigationController {
        return _topVC((vc as? UINavigationController)?.topViewController)
    } else if vc is UITabBarController {
        return _topVC((vc as? UITabBarController)?.selectedViewController)
    } else {
        return vc
    }
}

func delay(_ delay:Double, closure:@escaping ()->()) {
    DispatchQueue.main.asyncAfter(
        deadline: DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC), execute: closure)
}
